package controller;

import java.util.HashMap;

import project_package.*;

public class ProductController {

	private ProductRecords productRecordsCtrl;
	private static ProductController instance = null;
	
	public static ProductController getInstance()
    {
    	if(instance == null)
    	{
    		instance = new ProductController();
    	}
    	return instance;
    }
	
	public ProductController()
	{
		productRecordsCtrl = ProductRecords.getInstance();
	}
	
	public boolean createProduct(String name, double price, double discount, String description, int quantity, String location)
	{
		return productRecordsCtrl.createProduct(name, price, discount, description, quantity, location);
	}
	
	public boolean deleteProduct(String name)
	{
		return productRecordsCtrl.deleteProduct(name);
	}
	
	public boolean updateProduct(Product product, String name, double price, double discount, String description, int quantity, String location) // changed location to string
	{
		return productRecordsCtrl.updateProduct(product, name, price, discount, description, quantity, location);
	}
		
	public Product findProduct(String name)
	{
		return productRecordsCtrl.findProduct(name);
	}
	
	public int getQuantity(Product product) 
	{
		return productRecordsCtrl.getQuantity(product);
	}
	
	public String getLocation(Product product) 
	{
		return productRecordsCtrl.getLocation(product);
	}
	
	public int getTotalProducts()
	{
		return productRecordsCtrl.getTotalProducts();
	}
	
	public HashMap<Integer, Product> getProducts()
	{
		return productRecordsCtrl.getProducts();
	}
	
}